
package com.iocup.keybastion.authorize.parser;


import com.iocup.keybastion.annotion.RequiresUser;
import com.iocup.keybastion.authorize.decision.DecisionType;
import com.iocup.keybastion.authorize.element.AuthElement;

/**
 * @author xyjxust
 * @create 2022/3/2 13:44
 **/
public class RequiresUserElementParser implements AnnotationElementParser<RequiresUser> {

    @Override
    public AuthElement parser(String key, RequiresUser basicAuth) {
        return AuthElement.build()
                .code(key)
                .type(getType())
                .putParam("type", basicAuth.type());
    }

    @Override
    public String getType() {
        return DecisionType.requiresUser.name();
    }
}
